<?php
/*
 * 新锐手机注册 [ 深圳市新锐创意科技有限公司旗下产品 ]
 * Copyright  2015-2099 www.xinruiweb.com  All Rights Reserved.
 * 技术开发: 75674952@qq.com
 * 请支持正版授权产品
 */
if (!defined('IN_DISCUZ')) {
	exit('Access Denied');
}
require_once DISCUZ_ROOT.'./source/plugin/xinrui_mobilereg/config.php';

//error_reporting(E_ALL);
class plugin_xinrui_mobilereg_base{
    function common_base() {
        global $_G;
        loadcache(array('plugin'));
        if($_G['uid']) {
			$_G['xinrui_userinfo'] = C::t('#xinrui_mobilereg#xinrui_mobilereg_user')->fetch_first_by_uid($_G['uid']);
		}
    }
}


class plugin_xinrui_mobilereg extends plugin_xinrui_mobilereg_base{

    function plugin_xinrui_mobilereg() {

        global $_G;
		include_once template('xinrui_mobilereg:module');
	}

    function common() {
        global $_G;
        $this->common_base();
        
	}

    function global_header(){
        global $_G;
        if(CHARSET == 'gbk') {
            foreach($_G['XRLANG_MOBLIEREG'] as $key => $value) {
                $info[$key] = diconv($value, 'gbk','UTF-8');
            }
        }else{
            $info = $_G['XRLANG_MOBLIEREG'];
        }
        $global_header = '<script src="source/plugin/xinrui_mobilereg/static/js/jquery-1.11.0.min.js"></script>';
        $global_header .= '<script> var _G = '.json_encode($info).';var jq = $.noConflict(); var xinrui_mi = '.$_G['cache']['plugin']['xinrui_mobilereg']['code_time1'].';</script>';
        $global_header .= '<script src="source/plugin/xinrui_mobilereg/static/js/mobilereg.js"></script>';
        return $global_header;
    }

    function global_usernav_extra1() {
		global $_G;
        if(!$_G['uid']){
            return array();
        }
        
		return xinrui_mobilereg_tpl_setting_menu();
	}

}


class plugin_xinrui_mobilereg_member extends plugin_xinrui_mobilereg {

	function logging_member_message() {
		global $_G;
	}

    
    function logging_input() {
        global $_G;
        if($_G['uid']) {
            return;
        }
        if($_GET['viewlostpw'] == 1){
            return xinrui_mobilereg_tpl_logging_setting();
        }
        
    }

    function logging_top() {
        global $_G;
        if($_G['uid']) {
            return;
        }
        if(empty($_GET['viewlostpw'])){
            return xinrui_mobilereg_tpl_login_bar();
        }
    }

    function register_bottom() {
		global $_G;
        
		if($_G['uid']) {
            return;
        }
		return xinrui_mobilereg_tpl_reg_bar();
	}

}


class mobileplugin_xinrui_mobilereg extends plugin_xinrui_mobilereg_base {
    function common() {
		global $_G;
        $this->common_base();
        include_once template('xinrui_mobilereg:module');
    }

    function global_header_mobile() {
		global $_G;
        if(CHARSET == 'gbk') {
            foreach($_G['XRLANG_MOBLIEREG'] as $key => $value) {
                $info[$key] = diconv($value, 'gbk','UTF-8');
            }
        }else{
            $info = $_G['XRLANG_MOBLIEREG'];
        }
        return '<script> var _G = '.json_encode($info).'; var xinrui_mi = '.$_G['cache']['plugin']['xinrui_mobilereg']['code_time1'].';</script><script src="source/plugin/xinrui_mobilereg/static/js/mobilereg.js"></script>';
	}


    function global_footer_mobile() {
        global $_G;
        /*if(CURMODULE == 'space' && $_GET['do'] == 'profile' && $_G['uid']){
            if(empty($_G['xr_userinfo'])){  
                return home_space_profile_bind();
            }else if($_G['xr_userinfo']['uid'] == $_G['xr_userinfo']['bind']){
                return home_space_profile_my();
            }
        }*/
	}

}

class mobileplugin_xinrui_mobilereg_member extends mobileplugin_xinrui_mobilereg {
    function logging_bottom_mobile() {
		global $_G;

        if (isset($_G['cache']['plugin']['xinrui_mobilereg']['login_mobile1']) && $_G['cache']['plugin']['xinrui_mobilereg']['login_mobile1'] == 1){
            if(CURMODULE == 'logging' && $_GET['action'] == 'login'){
                dheader('Location:plugin.php?id=xinrui_mobilereg&mod=setting&op=mlogin');
            }
        }else{
            return tpl_login_bottom_mobile();
        }
        
		
    }

}


?>
